load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

package_group(
    name = "types_friend",
    packages = [
        "-//config/...",
        "//...",
    ],
)

go_library(
    name = "types",
    srcs = [
        "binary_literal.go",
        "compare.go",
        "convert.go",
        "core_time.go",
        "datum.go",
        "datum_eval.go",
        "enum.go",
        "errors.go",
        "etc.go",
        "eval_type.go",
        "explain_format.go",
        "field_name.go",
        "field_type.go",
        "field_type_builder.go",
        "fsp.go",
        "helper.go",
        "json_binary.go",
        "json_binary_functions.go",
        "json_constants.go",
        "json_path_expr.go",
        "mydecimal.go",
        "overflow.go",
        "set.go",
        "time.go",
    ],
    importpath = "github.com/pingcap/tidb/types",
    visibility = [
        ":types_friend",
    ],
    deps = [
        "//errno",
        "//parser/ast",
        "//parser/charset",
        "//parser/model",
        "//parser/mysql",
        "//parser/opcode",
        "//parser/terror",
        "//parser/types",
        "//sessionctx/stmtctx",
        "//util/collate",
        "//util/dbterror",
        "//util/hack",
        "//util/kvcache",
        "//util/logutil",
        "//util/mathutil",
        "//util/parser",
        "//util/size",
        "//util/stringutil",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_log//:log",
        "@org_golang_x_exp//slices",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "types_test",
    timeout = "short",
    srcs = [
        "benchmark_test.go",
        "binary_literal_test.go",
        "compare_test.go",
        "const_test.go",
        "convert_test.go",
        "core_time_test.go",
        "datum_test.go",
        "enum_test.go",
        "errors_test.go",
        "etc_test.go",
        "export_test.go",
        "field_type_test.go",
        "format_test.go",
        "fsp_test.go",
        "helper_test.go",
        "json_binary_functions_test.go",
        "json_binary_test.go",
        "json_path_expr_test.go",
        "main_test.go",
        "mydecimal_benchmark_test.go",
        "mydecimal_test.go",
        "overflow_test.go",
        "set_test.go",
        "time_test.go",
    ],
    embed = [":types"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//parser/charset",
        "//parser/mysql",
        "//parser/terror",
        "//session",
        "//sessionctx/stmtctx",
        "//testkit",
        "//testkit/testsetup",
        "//util/collate",
        "//util/hack",
        "//util/mock",
        "@com_github_pingcap_errors//:errors",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
